package model

import "time"

// 中台请求
type MergeStartRequest struct {
	OldDBs      []DBConn       `json:"old_dbs" binding:"required,min=1"`
	NewDB       DBConn         `json:"new_db" binding:"required"`
	CallbackURL string         `json:"callback_url" binding:"required,url"`
	ExternalID  string         `json:"external_id,omitempty"`
	Options     map[string]any `json:"options,omitempty"`
}

// 游戏服请求
type GameExecuteRequest struct {
	SourceDSNs []string       `json:"source_dsns"`
	TargetDSN  string         `json:"target_dsn"`
	Options    map[string]any `json:"options,omitempty"`
	TraceID    string         `json:"trace_id"`
}

// 游戏服响应
type GameExecuteResponse struct {
	Status string         `json:"status"`
	Detail string         `json:"detail,omitempty"`
	Stats  map[string]any `json:"stats,omitempty"`
}

// 回调中台
type CallbackToMiddle struct {
	MergeID string         `json:"merge_id"`
	Status  string         `json:"status"`
	Detail  string         `json:"detail,omitempty"`
	Stats   map[string]any `json:"stats,omitempty"`
}

type MergeStatus string

const (
	StatusRunning MergeStatus = "RUNNING"
	StatusSuccess MergeStatus = "SUCCESS"
	StatusFailed  MergeStatus = "FAILED"
)

type MergeTask struct {
	ID        string
	Request   MergeStartRequest
	Status    MergeStatus
	Result    *GameExecuteResponse
	CreatedAt time.Time
	UpdatedAt time.Time
}
